///*
// * CS_DUNGEON_ENABLE_MAP_CHANGE_READY.h
// *
// *  Created on: 2013. 8. 27.
// *      Author: jjaehuny
// */
//
//#ifndef _PROJECTZ_NUSER_NCOMMAND_CS_DUNGEON_ENABLE_MAP_CHANGE_READY_H_
//#define _PROJECTZ_NUSER_NCOMMAND_CS_DUNGEON_ENABLE_MAP_CHANGE_READY_H_
//
//#include "../../engine.h"
//
//#include "../../User.h"
//#include "../../Data.h"
//
//#include "../../NLogic/Static.h"
//#include "../../NLogic/Battle.h"
//
//namespace ProjectZ { namespace NCommand { namespace NMatching {
//
///*
// * 던전 맵 완료 후 다른 맵으로 이동 시 가능 여부 확인 패킷
// * auth : jjaehuny@gamevil.com
// */
//
//class CS_DUNGEON_ENABLE_MAP_CHANGE_READY
//{
//public:
//	static void OnExecute(User * pUser, ::Network::Packet * pPacket)
//	{
//		/* message
//		 * CS_DUNGEON_ENABLE_MAP_CHANGE_READY	0x080C		2	unsigned short	맵 TID
//		 */
//
//		NLogic::Space * pSpace = pUser->GetSpace();
//		if (NULL == pSpace)
//		{
//			DEBUGLOG("CS_DUNGEON_ENABLE_MAP_CHANGE_READY NULL == pSpace");
//			return;
//		}
//
//		if (pSpace->GetData()._spaceType != NLogic::Space::SpaceType::SINGLE_DUNGEION &&
//				pSpace->GetData()._spaceType != NLogic::Space::SpaceType::PARTY_DUNGEION )
//		{
//			DEBUGLOG("CS_DUNGEON_ENABLE_MAP_CHANGE_READY space is not single or party dungeion");
//			return;
//		}
//
//		PREPARE_PACKET;
//
//		int map_tid = 0;
//		pPacket->ParseMsg("%2d", &map_tid);
//
//		::Logger::GETLOG()->ToFile(::Logger::DEBUG, "GID %d CS_DUNGEON_ENABLE_MAP_CHANGE_READY, map_tid=%d, degree=%d, enable=%d", pUser->GetGID(), map_tid);
//
//		//
//		//NLogic::Space * pSpace = pUser->GetSpace();
//		const NLogic::Space::USERTREE & clsUserTree = pSpace->GetUserTree();
//		if (true == clsUserTree.empty())
//			return;
//
//		if (pUser->player_info.DungeonInfo.map_tid == map_tid)
//			return;
//
//		std::for_each(clsUserTree.begin(), clsUserTree.end(), [&](const std::pair<const int, ProjectZ::User *> & pair){
//			User * pTargetUser = pair.second;
//			pTargetUser->player_info.DungeonInfo.map_tid = map_tid;
//			pTargetUser->player_info.DungeonInfo.next_map_tid = 0;
//
//			pTargetUser->GetBattle()->GetData()._enable_map_clear = false;
//		} );
//
//		// 모두 가능 상태이므로 이때 맵 아이디를 변경해야 한다.
////		::ProjectZ::NGame::CBaseSpace::CITR citr = playerTree.begin();
////		for(;citr != playerTree.end(); citr++)
////		{
////			User * pTargetUser = ( * citr ).second;
////			pTargetUser->player_info.DungeonInfo.map_tid = map_tid;
////			pTargetUser->player_info.DungeonInfo.next_map_tid = 0;
////		}
//
//		::Network::Packet * pNoti = ::Network::GETPACKETPOOL()->SEND_NEW();
//		pNoti->MsgCat("%2d%2d%2d%2d", pUser->player_info.DungeonInfo.map_tid, pUser->player_info.x, pUser->player_info.y, pUser->player_info.degree);
//		pNoti->MakePacket(CMD_SN_DUNGEON_MAP_CHANGE);
//		pSpace->SendAll(pNoti);
//
//		pSpace->GetData()._enableCount = 0;
//		pSpace->ClearMonsterTree();
//		pSpace->GetData()._bSendMapChange = true;
//	}
//};
//
//} /*NBattle*/ } /*NCommand*/ } /*ProjectZ*/
//
//
//#endif /* _PROJECTZ_NUSER_NCOMMAND_CS_DUNGEON_ENABLE_MAP_CHANGE_READY_H_ */
